#include <cstdio>
#include "vl_c_config_support.h"
#include "vl_c_dep_support.h"

using namespace VL;


/**
 * @Author: CimZzz
 * @Date: 2022-08-19 15:31:03
 * 
 * 构造函数
 */
CConfigSupport::CConfigSupport(): VLSupport(VLSupport::Aspect::Configure) {

}

/**
 * @Author: CimZzz
 * @Date: 2022-08-19 15:53:54
 * 
 * 执行动作
 * 
 * @param env 环境变量
 */
void CConfigSupport::doAction(VLEnv* env) {
	// 加载 C / C++ 项目工程配置文件, 转换为内存中的数据类型
	this->initProjectMustExist(env);

	auto projectProp = env->projectProperties;
	auto commonParams = env->commonParams;
	auto configureParams = env->configureParams;

	// 获取 CDepBundle
	CDepSupport depSupport;
	env->dependencyParams = std::shared_ptr<DependencyParams>(new DependencyParams);
	env->dependencyParams->depOptions = DependencyParams::DepOptions::DO_OnlyCheckDep;
	env->dependencyParams->needPrint = false;
	depSupport.doAction(env);
	auto depBundle = env->getVariable<CDepBundle>("C_DEP_BUNDLE");

	// 检查 env 中是否已经存在对应的配置信息
	auto configBundle = env->getVariable<CConfigBundle>("C_CONFIG_BUNDLE");
	if(configBundle.get() == nullptr) {
		configBundle = std::shared_ptr<CConfigBundle>(new CConfigBundle());
		// 将配置文件更新至环境变量中
		env->saveVariable("C_CONFIG_BUNDLE", configBundle);
	}
	if(env->commonParams->vlpFeature.get() == nullptr) {
		env->commonParams->vlpFeature.reset(new VLPFeature());
	}
	auto feature = env->commonParams->vlpFeature;
	// 添加宏值
	feature->marcoMap.emplace("VL_PROJ_DIR", env->projectDir->getAbsolutePath());
	// 加载项目工程配置文件
	auto configPropPtr = env->loadProjectConfigFile(feature.get(), configureParams->ignoreConfigError);

	/**
	 * ****************************************************************************************
	 * @Author: CimZzz
	 * @Date: 2022-08-20 16:31:16
	 * 代码块说明: 
	 * 
	 * 编译参数解析
	 * 
	 */
	// 检查是否需要进行编译参数配置
	if((configureParams->configOptions & ConfigureParams::ConfigOptions::CO_CompileOption) != 0 && (configBundle->aspect & ConfigureParams::ConfigOptions::CO_CompileOption) == 0) {
		// 设置缺省的编译工具链
		configBundle->CC = "gcc";
		configBundle->CXX = "g++";
		configBundle->AR = "ar";
		configBundle->RANLIB = "ranlib";
		configBundle->SYSROOT = "";

		// 检查编译工具链文件, 针对编译工具链进行修改和补充
		auto toolChainBundle = env->getVariable<CToolchainBundle>("C_TOOLCHAIN_BUNDLE");
		if(toolChainBundle.get() == nullptr) {
			// 变量中不存在编译工具链数据集, 查看是否存在工具链文件
			// 如果存在则读取工具链中的编译工具指令, 并且将这些存储到环境变量中
			if(commonParams->toolchainFile.get() != nullptr) {
				// 存在, 对编译工具链文件进行解析
				RootProp toolchainProp;
				if(!toolchainProp.readFromVLPFile(*commonParams->toolchainFile)) {
					// 加载失败, 抛出异常
					this->throwException("analyze toolchain file failed: %s", commonParams->toolchainFile->getAbsolutePathStr());
				}
				toolChainBundle = std::shared_ptr<CToolchainBundle>(new CToolchainBundle());
				toolChainBundle->CC = toolchainProp["CC"]->getValue();
				toolChainBundle->CXX = toolchainProp["CXX"]->getValue();
				toolChainBundle->AR = toolchainProp["AR"]->getValue();
				toolChainBundle->RANLIB = toolchainProp["RANLIB"]->getValue();
				toolChainBundle->SYSROOT = toolchainProp["SYSROOT"]->getValue();

				// 保存到环境变量中
				env->saveVariable("C_TOOL_CHAIN_BUNDLE", toolChainBundle);
			}
		}
		// 再次检查编译工具链文件, 做出最终编译工具链的裁定
		if(toolChainBundle.get() != nullptr) {
			if(!toolChainBundle->CC.empty()) {
				configBundle->CC = toolChainBundle->CC;
			}
			if(!toolChainBundle->CXX.empty()) {
				configBundle->CXX = toolChainBundle->CXX;
			}
			if(!toolChainBundle->AR.empty()) {
				configBundle->AR = toolChainBundle->AR;
			}
			if(!toolChainBundle->RANLIB.empty()) {
				configBundle->RANLIB = toolChainBundle->RANLIB;
			}
			if(!toolChainBundle->SYSROOT.empty()) {
				configBundle->SYSROOT = toolChainBundle->SYSROOT;
			}
		}

		// 读取项目工程配置文件中的 CFLAGS、CXXFLAGS 和 CPPFALGS
		configBundle->CFLAGS = VLFlag(configPropPtr->get("CFLAGS"), " ");
		configBundle->CXXFLAGS = VLFlag(configPropPtr->get("CXXFLAGS"), " ");
		configBundle->CPPFLAGS = VLFlag(configPropPtr->get("CPPFLAGS"), " ");
		
		// 并入依赖文件中的配置
		if(depBundle.get() != nullptr) {
			for(auto depIter = depBundle->depMap->begin() ; depIter != depBundle->depMap->end() ; depIter ++) {
				std::string depFlags = "-I\"" + depIter->second->includeDirPtr->getAbsolutePath() + "\"";
				configBundle->CFLAGS += depFlags;
				configBundle->CXXFLAGS += depFlags;
			}
		}

		// 检查项目中是否存在 Version
		auto versionPropPtr = configPropPtr->get("VERSION");
		if(versionPropPtr->isNode()) {
			configBundle->CPPFLAGS += "-DVL_SPEC_VERSION=\"\\\"" + versionPropPtr->getValue() + "\"\\\"";
		}

		configBundle->aspect |= ConfigureParams::ConfigOptions::CO_CompileOption;
	}


	/**
	 * ****************************************************************************************
	 * @Author: CimZzz
	 * @Date: 2022-08-20 16:31:26
	 * 代码块说明: 
	 * 
	 * 依赖文件解析
	 * 
	 */
	if((configureParams->configOptions & ConfigureParams::ConfigOptions::CO_ReadDependencies) != 0 && (configBundle->aspect & ConfigureParams::ConfigOptions::CO_ReadDependencies) == 0) {
		// 依次解析, 先解析依赖文件
		auto vlLibsPropPtr = configPropPtr->get("VL_LIBS");
		if(vlLibsPropPtr->isMap()) {
			// VL_LIBS 节点必须为 Map 类型
			auto vlLibsMapPropPtr = (MapProp*) vlLibsPropPtr.get();
			for(auto iter = vlLibsMapPropPtr->begin() ; iter != vlLibsMapPropPtr->end() ; iter ++) {
				// 库名
				auto libName = iter->first;
				auto libSettingsPropPtr = iter->second;
				// 库配置项, 同样必须为 Map 类型
				if(!libSettingsPropPtr->isMap()) {
					// 配置错误, 属于重要错误, 抛出异常
					this->throwException("dependency %s wrong settings", libName.c_str());
				}
				auto libSettingsMapPropPtr = (MapProp *) libSettingsPropPtr.get();

				// 加载依赖配置项中的 method、path、branch
				auto method = libSettingsMapPropPtr->get("method")->getValue();
				auto path = libSettingsMapPropPtr->get("path")->getValue();
				auto branch = libSettingsMapPropPtr->get("branch")->getValue();

				if(method != "git") {
					// 当前仅支持 git 方式拉取依赖库
					this->throwException("dependency %s unsupport method: %s", libName.c_str(), method.c_str());
				}
				if(path.empty()) {
					// 当前仅支持 git 方式拉取依赖库
					this->throwException("dependency %s must specify path", libName.c_str());
				}
				if(branch.empty()) {
					// 缺省分支为 master
					branch = "master";
				}
				std::shared_ptr<CRemoteDependencyBundle> dependencyBundle(new CRemoteDependencyBundle);
				dependencyBundle->name = libName;
				dependencyBundle->method = method;
				dependencyBundle->path = path;
				dependencyBundle->extraInfo = branch;

				if(configBundle->remoteDependenciesPtr.get() == nullptr) {
					configBundle->remoteDependenciesPtr = std::shared_ptr<std::vector<std::shared_ptr<CRemoteDependencyBundle>>>(new std::vector<std::shared_ptr<CRemoteDependencyBundle>>);
				}
				configBundle->remoteDependenciesPtr->push_back(dependencyBundle);
			}
		}

		configBundle->aspect |= ConfigureParams::ConfigOptions::CO_ReadDependencies;
	}
	
	// 开始加载和源码相关的配置, 获取源码文件池、测试源码文件池、目标文件池、位置无关目标文件池、头文件池
	auto sourceFilePool = configBundle->sourceFilePool;
	auto testSourceFilePool = configBundle->testSourceFilePool;
	auto targetFilePool = configBundle->targetFilePool;
	auto libTargetFilePool = configBundle->libTargetFilePool;
	auto testTargetFilePool = configBundle->testTargetFilePool;
	auto headerFilePool = configBundle->headerFilePool;
	// 获取源码文件目录、测试源码目录、目标文件生成目录、库目标文件生成目录、测试目标文件生成目录、产品一致性校验目录、源码和目标文件一致性校验目录
	auto srcDir = projectProp->srcDir;
	auto testDir = projectProp->testDir;
	auto targetDir = projectProp->targetDir;
	auto libTargetDir = projectProp->libraryTargetDir;
	auto testTargetDir = projectProp->testTargetDir;
	auto productValidDir = projectProp->propDir;
	auto targetValidDir = projectProp->propSrcDir;
	VLFile testProductDir = projectProp->productTestDir;
	VLFile execProductDir;
	VLFile libProductDir;
	if(commonParams->installDir.get() != nullptr) {
		// 如果指定了安装目录, 则切换产品生成目录
		execProductDir = VLFile(*commonParams->installDir, "bin");
		libProductDir = VLFile(*commonParams->installDir, "lib");
	} else {
		// 未指定安装目录, 使用默认的生成目录
		execProductDir = projectProp->productBinDir;
		libProductDir = projectProp->productLibDir;
	}


	/**
	 * ****************************************************************************************
	 * @Author: CimZzz
	 * @Date: 2022-08-20 17:26:37
	 * 代码块说明: 
	 * 
	 * 测试项目解析
	 * 
	 */
	if((configureParams->configOptions & ConfigureParams::ConfigOptions::CO_CompileTest) == ConfigureParams::ConfigOptions::CO_CompileTest && (configBundle->aspect & ConfigureParams::ConfigOptions::CO_CompileTest) != ConfigureParams::ConfigOptions::CO_CompileTest) {
		// 加载测试项目配置
		auto testPropPtr = configPropPtr->get("TEST");
		if(testPropPtr->isMap()) {
			// TEST 必须为 Map 类型
			auto testMapPropPtr = (MapProp *) testPropPtr.get();
			for(auto testIter = testMapPropPtr->begin() ; testIter != testMapPropPtr->end() ; testIter ++) {
				// 测试用例名
				auto testName = testIter->first;
				auto testSettingsPropPtr = testIter->second;
				// 测试配置项, 同样必须为 Map 类型
				if(!testSettingsPropPtr->isMap()) {
					this->throwException("test %s wrong settings", testName.c_str());
				}
				auto testSettingsMapPropPtr = (MapProp *) testSettingsPropPtr.get();

				// 加载配置项目中的 DESC、ENABLE、COMPILE_FLAGS、CPPFLAGS、LDFLAGS、ENTRY、SOURCES
				auto desc = testSettingsMapPropPtr->get("DESC")->getValue();
				auto enable = testSettingsMapPropPtr->get("ENABLE")->getValue();
				auto check = testSettingsMapPropPtr->get("CHECK")->getValue();
				VLFlag compileFlags(testSettingsMapPropPtr->get("COMPILE_FLAGS"), " ");
				VLFlag cppflags(testSettingsMapPropPtr->get("CPPFLAGS"), " ");
				VLFlag ldflags(testSettingsMapPropPtr->get("LDFLAGS"), " ");
				auto entryPropPtr = testSettingsMapPropPtr->get("ENTRY");
				auto sourcePropPtr = testSettingsMapPropPtr->get("SOURCES");
				auto libPropPtr = testSettingsMapPropPtr->get("VL_LIBS");

				if(enable == "false") {
					// 表示该测试项已禁用, 跳过
					continue;
				}

				if(!enable.empty() && enable != "true") {
					this->throwException("test %s wrong settings for ENABLE, must be \"true\" or \"false\", but value is %s", testName.c_str(), enable.c_str());
				}

				// 测试源码文件必须为 Node 类型, 且指向的源文件必须存在
				if(!entryPropPtr->isNode()) {
					this->throwException("test %s wrong settings for ENTRY, must be source file at \"test\" dir", testName.c_str());
				}
				auto entryKey = entryPropPtr->getValue();

				// 加载源码文件
				auto entryFilePtr = testSourceFilePool->fetchFile(entryKey, [&]() {
					return this->makeSourceFilePtr(testDir, targetValidDir, entryKey, true);
				});
				entryFilePtr->addFileFlags(CFileType::CFT_TEST);

				auto entryTargetFilePtr = testTargetFilePool->fetchFile(entryKey, [&]() {
					return this->makeTargetFilePtr(false, testTargetDir, targetValidDir, entryKey, entryFilePtr, true);
				});

				auto testBundlePtr = std::shared_ptr<CTestBundle>(new CTestBundle);
				entryFilePtr->setExtraInfo(testBundlePtr.get());
				entryTargetFilePtr->setExtraInfo(testBundlePtr.get());

				auto testFilePtr = this->makeExecutableFilePtr(testProductDir, productValidDir, testName);

				testFilePtr->setFileFlags(CFileType::CFT_EXEC);
				testFilePtr->addFileFlags(CFileType::CFT_TEST);

				testFilePtr->addDependentFile(entryTargetFilePtr);
				if(entryFilePtr->containFlag(CFileType::CFT_CPP)) {
					// 如果源文件中存在 C++ 类型, 那么可执行文件也会切换成 C++ 方式来编译
					testFilePtr->addFileFlags(CFileType::CFT_CPP);
				}


				// 源码属性必须为 Array 类型
				if(sourcePropPtr->isArray()) {
					auto sourceArrPropPtr = (ArrayProp *) sourcePropPtr.get();
					for(auto srcIter = sourceArrPropPtr->begin() ; srcIter != sourceArrPropPtr->end() ; srcIter ++) {
						// 文件键值
						auto srcKey = (*srcIter)->getValue();
						// 创建源文件
						auto sourceFilePtr = sourceFilePool->fetchFile(srcKey, [&]() {
							// 为源文件配置文件类型
							return this->makeSourceFilePtr(srcDir, targetValidDir, srcKey);
						});
						// 为源文件生成对应的目标文件
						auto targetFilePtr = targetFilePool->fetchFile(srcKey, [&]() {
							return this->makeTargetFilePtr(false, targetDir, targetValidDir, srcKey, sourceFilePtr);
						});
						// 将目标文件作为可执行项目的依赖文件
						testFilePtr->addDependentFile(targetFilePtr);
						if(targetFilePtr->containFlag(CFileType::CFT_CPP)) {
							// 如果源文件中存在 C++ 类型, 那么可执行文件也会切换成 C++ 方式来编译
							testFilePtr->addFileFlags(CFileType::CFT_CPP);
						}
					}
				}
				if(libPropPtr->isArray()) {
					if(depBundle.get() != nullptr) {
						auto depMap = depBundle->depMap;
						auto libArrPropPtr = (ArrayProp *) libPropPtr.get();
						for(auto depIter = libArrPropPtr->begin() ; depIter != libArrPropPtr->end() ; depIter ++) {
							auto depName = (*depIter)->getValue();
							auto existDep = depMap->find(depName);
							if(existDep == depMap->end()) {
								// 如果已经加载完毕依赖, 但是没有找到对应依赖库
								this->throwException("do not found dep %s, in test unit: %s", depName.c_str(), testName.c_str());
							}
							auto staticFilePtr = existDep->second->staticFilePtr;
							if(staticFilePtr.get() != nullptr) {
								if(!staticFilePtr->isExist()) {
									this->throwException("dep %s static file broken, in test unit: %s", depName.c_str(), testName.c_str());
								}
								std::shared_ptr<FileWrapper> libraryFilePtr(new FileWrapper(new VLFile(*staticFilePtr)));
								libraryFilePtr->setFileFlags(CFileType::CFT_STATIC);
								libraryFilePtr->setFileChanged(false);
								testFilePtr->addDependentFile(libraryFilePtr);
							}

							if(!existDep->second->LDFLAGS.empty()) {
								ldflags += existDep->second->LDFLAGS;
							}
						}
					} else {
						// 标记为缺失依赖库
						testBundlePtr->dismissDep = true;
					}
				}

				testBundlePtr->name = testName;
				testBundlePtr->desc = desc;
				if(entryFilePtr->containFlag(CFileType::CFT_CPP)) {
					testBundlePtr->COMPILE_FLAGS += configBundle->CXXFLAGS;
				} else {
					testBundlePtr->COMPILE_FLAGS += configBundle->CFLAGS;
				}
				testBundlePtr->COMPILE_FLAGS += compileFlags;
				testBundlePtr->CPPFLAGS += configBundle->CPPFLAGS;
				testBundlePtr->CPPFLAGS += cppflags;
				testBundlePtr->LDFLAGS = ldflags;
				testBundlePtr->testFilePtr = testFilePtr;

				if(configBundle->testBundlesPtr.get() == nullptr) {
					configBundle->testBundlesPtr.reset(new std::vector<std::shared_ptr<CTestBundle>>);
				}

				configBundle->testBundlesPtr->push_back(testBundlePtr);

				if(check == "true") {
					// 用于测试用例的参数列表
					testBundlePtr->isCheckItem = true;
					auto passParamsProp = testSettingsMapPropPtr->get("PARAMS");
					if(passParamsProp->isArray()) {
						auto passParamsArrProp = (ArrayProp *)passParamsProp.get();
						for(auto paramsIter = passParamsArrProp->begin() ; paramsIter != passParamsArrProp->end() ; paramsIter ++) {
							if(testBundlePtr->passParamsList.get() == nullptr) {
								testBundlePtr->passParamsList.reset(new std::vector<std::string>());
							}
							testBundlePtr->passParamsList->push_back((*paramsIter)->getValue());
						}
					}
					if(configBundle->checkTestBundlesPtr.get() == nullptr) {
						configBundle->checkTestBundlesPtr.reset(new std::vector<std::shared_ptr<CTestBundle>>);
					}

					configBundle->checkTestBundlesPtr->push_back(testBundlePtr);
				}
			}
		}



		configBundle->aspect |= ConfigureParams::ConfigOptions::CO_CompileTest;
	}


	/**
	 * ****************************************************************************************
	 * @Author: CimZzz
	 * @Date: 2022-08-20 16:31:46
	 * 代码块说明: 
	 * 
	 * 可执行项目解析
	 * 
	 */
	if((configureParams->configOptions & ConfigureParams::ConfigOptions::CO_CompileExecutable) == ConfigureParams::ConfigOptions::CO_CompileExecutable && (configBundle->aspect & ConfigureParams::ConfigOptions::CO_CompileExecutable) != ConfigureParams::ConfigOptions::CO_CompileExecutable) {
		// 加载可执行项目配置
		auto programsPropPtr = configPropPtr->get("PROGRAMS");
		if(programsPropPtr->isMap()) {
			// PROGRAMS 必须为 Map 类型
			auto programsMapPropPtr = (MapProp*) programsPropPtr.get();
			for(auto programIter = programsMapPropPtr->begin() ; programIter != programsMapPropPtr->end() ; programIter ++) {
				// 可执行文件名
				auto progName = programIter->first;
				auto progSettingsPropPtr = programIter->second;
				// 可执行配置项, 同样必须为 Map 类型
				if(!progSettingsPropPtr->isMap()) {
					// 配置错误, 属于重要错误, 抛出异常
					this->throwException("program %s wrong settings", progName.c_str());
				}
				auto progSettingsMapPropPtr = (MapProp *) progSettingsPropPtr.get();
				
				// 加载可执行配置项中的 LDFLAGS、SOURCES
				VLFlag ldflags(progSettingsMapPropPtr->get("LDFLAGS"), " ");
				auto sourcePropPtr = progSettingsMapPropPtr->get("SOURCES");
				auto libPropPtr = progSettingsMapPropPtr->get("VL_LIBS");
				// 源码属性必须为 Array 类型
				if(!sourcePropPtr->isArray()) {
					this->throwException("program %s sources invalid", progName.c_str());
				}
				auto sourceArrPropPtr = (ArrayProp *) sourcePropPtr.get();

				// 解析完成, 生成可执行项目
				auto execBundlePtr = std::shared_ptr<CExecutableBundle>(new CExecutableBundle);

				auto execFilePtr = this->makeExecutableFilePtr(execProductDir, productValidDir, progName);
				execFilePtr->setFileFlags(CFileType::CFT_EXEC);

				for(auto srcIter = sourceArrPropPtr->begin() ; srcIter != sourceArrPropPtr->end() ; srcIter ++) {
					// 文件键值
					auto srcKey = (*srcIter)->getValue();
					// 创建源文件
					auto sourceFilePtr = sourceFilePool->fetchFile(srcKey, [&]() {
						// 为源文件配置文件类型
						return this->makeSourceFilePtr(srcDir, targetValidDir, srcKey);
					});
					// 为源文件生成对应的目标文件
					auto targetFilePtr = targetFilePool->fetchFile(srcKey, [&]() {
						return this->makeTargetFilePtr(false, targetDir, targetValidDir, srcKey, sourceFilePtr);
					});
					// 将目标文件作为可执行项目的依赖文件
					execFilePtr->addDependentFile(targetFilePtr);
					if(targetFilePtr->containFlag(CFileType::CFT_CPP)) {
						// 如果源文件中存在 C++ 类型, 那么可执行文件也会切换成 C++ 方式来编译
						execFilePtr->addFileFlags(CFileType::CFT_CPP);
					}
				}


				if(libPropPtr->isArray()) {
					if(depBundle.get() != nullptr) {
						auto depMap = depBundle->depMap;
						auto libArrPropPtr = (ArrayProp *) libPropPtr.get();
						for(auto depIter = libArrPropPtr->begin() ; depIter != libArrPropPtr->end() ; depIter ++) {
							auto depName = (*depIter)->getValue();
							auto existDep = depMap->find(depName);
							if(existDep == depMap->end()) {
								// 如果已经加载完毕依赖, 但是没有找到对应依赖库
								this->throwException("do not found dep %s, in test unit: %s", depName.c_str(), progName.c_str());
							}
							auto staticFilePtr = existDep->second->staticFilePtr;
							if(staticFilePtr.get() != nullptr) {
								if(!staticFilePtr->isExist()) {
									this->throwException("dep %s static file broken, in test unit: %s", depName.c_str(), progName.c_str());
								}
								std::shared_ptr<FileWrapper> libraryFilePtr(new FileWrapper(new VLFile(*staticFilePtr)));
								libraryFilePtr->setFileFlags(CFileType::CFT_STATIC);
								libraryFilePtr->setFileChanged(false);
								execFilePtr->addDependentFile(libraryFilePtr);
							}

							if(!existDep->second->LDFLAGS.empty()) {
								ldflags += existDep->second->LDFLAGS;
							}
						}
					} else {
						// 标记为缺失依赖库
						execBundlePtr->dismissDep = true;
					}
				}

				execBundlePtr->name = progName;
				execBundlePtr->LDFLAGS = ldflags;
				execBundlePtr->executableFilePtr = execFilePtr;

				if(configBundle->execBundlesPtr.get() == nullptr) {
					configBundle->execBundlesPtr.reset(new std::vector<std::shared_ptr<CExecutableBundle>>);
				}
				configBundle->execBundlesPtr->push_back(execBundlePtr);
			}
		}

		configBundle->aspect |= ConfigureParams::ConfigOptions::CO_CompileExecutable;
	}

	

	/**
	 * ****************************************************************************************
	 * @Author: CimZzz
	 * @Date: 2022-08-20 16:31:56
	 * 代码块说明: 
	 * 
	 * 库项目解析
	 * 
	 */
	if((configureParams->configOptions & ConfigureParams::ConfigOptions::CO_CompileLibrary) == ConfigureParams::ConfigOptions::CO_CompileLibrary && (configBundle->aspect & ConfigureParams::ConfigOptions::CO_CompileLibrary) != ConfigureParams::ConfigOptions::CO_CompileLibrary) {
		// 加载库项目配置
		auto librariesPropPtr = configPropPtr->get("LIBRARIES");
		if(librariesPropPtr->isMap()) {
			// LIBRARIES 必须为 Map 类型
			auto librariesMapPropPtr = (MapProp *) librariesPropPtr.get();
			for(auto libraryIter = librariesMapPropPtr->begin() ; libraryIter != librariesMapPropPtr->end() ; libraryIter ++) {
				auto libName = libraryIter->first;
				auto libSettingsPropPtr = libraryIter->second;
				// 库项目配置项, 同样必须为 Map 类型
				if(!libSettingsPropPtr->isMap()) {
					// 配置错误, 属于重要错误, 抛出异常
					this->throwException("library %s wrong settings", libName.c_str());
				}
				auto libSettingsMapPropPtr = (MapProp *) libSettingsPropPtr.get();

				// 加载库配置项中的 LDFLAGS、HEADERS、SOURCES
				VLFlag ldflags(libSettingsMapPropPtr->get("LDFLAGS"), " ");
				auto headerPropPtr = libSettingsMapPropPtr->get("HEADERS");
				auto sourcePropPtr = libSettingsMapPropPtr->get("SOURCES");
				auto libPropPtr = libSettingsMapPropPtr->get("VL_LIBS");
				// 头文件属性必须为 Array 类型
				if(!headerPropPtr->isArray()) {
					this->throwException("library %s headers invalid", libName.c_str());
				}
				auto headerArrPropPtr = (ArrayProp *) headerPropPtr.get();

				// 实例化库项目数据集, 并设置库项目安装目录
				auto libraryBundlePtr = std::shared_ptr<CLibraryBundle>(new CLibraryBundle);
				VLFile libraryInstallDir(libProductDir, libName);
				VLFile libraryIncludeInstallDir(libraryInstallDir, "include");
				VLFile libraryLibInstallDir(libraryInstallDir, "lib");

				// 设置 库校验文件、库项目名称、LDFLAGS
				libraryBundlePtr->libraryTsFile = std::shared_ptr<ValidFile>(new ValidFile(new VLFile(productValidDir, "lib_header_" + libName + "_ts")));

				// 解析头文件列表
				for(auto headerIter = headerArrPropPtr->begin() ; headerIter != headerArrPropPtr->end() ; headerIter ++) {
					// 文件 Key 值
					auto headerKey = (*headerIter)->getValue();
					auto srcHeaderFilePtr = headerFilePool->fetchFile(headerKey, [&](){
						return this->makeHeaderFilePtr(srcDir, headerKey);
					}, true);
					auto headerFilePtr = this->makeHeaderFilePtr(libraryIncludeInstallDir, headerKey);

					headerFilePtr->addDependentFile(srcHeaderFilePtr);
					headerFilePtr->setFileKey(headerFilePtr->getAbsolutePathStr());

					libraryBundlePtr->headerFileListPtr.push_back(headerFilePtr);
				}

				// 解析源文件列表
				if(sourcePropPtr->isArray()) {
					auto sourceArrPropPtr = (ArrayProp *) sourcePropPtr.get();
					// 存在源文件, 创建静态库文件和动态库文件
					auto dynamicFilePtr = this->makeLibraryFilePtr(0, libraryLibInstallDir, productValidDir, libName);
					auto staticFilePtr = this->makeLibraryFilePtr(1, libraryLibInstallDir, productValidDir, libName);
					auto nopStaticFilePtr = this->makeLibraryFilePtr(2, libraryLibInstallDir, productValidDir, libName);

					for(auto srcIter = sourceArrPropPtr->begin() ; srcIter != sourceArrPropPtr->end() ; srcIter ++) {
						// 文件键值
						auto srcKey = (*srcIter)->getValue();
						// 创建源文件
						auto sourceFilePtr = sourceFilePool->fetchFile(srcKey, [&]() {
							// 为源文件配置文件类型
							return this->makeSourceFilePtr(srcDir, targetValidDir, srcKey);
						});
						// 为源文件生成对应的动态库目标文件
						auto dymTargetFilePtr = libTargetFilePool->fetchFile(srcKey, [&]() {
							return this->makeTargetFilePtr(true, libTargetDir, targetValidDir, srcKey, sourceFilePtr);
						});
						// 为源文件生成对应的静态库目标文件
						auto staticTargetFilePtr = targetFilePool->fetchFile(srcKey, [&]() {
							return this->makeTargetFilePtr(false, targetDir, targetValidDir, srcKey, sourceFilePtr);
						});
						// 将目标文件作为库文件的依赖文件
						dynamicFilePtr->addDependentFile(dymTargetFilePtr);
						nopStaticFilePtr->addDependentFile(dymTargetFilePtr);
						staticFilePtr->addDependentFile(staticTargetFilePtr);
						if(dymTargetFilePtr->containFlag(CFileType::CFT_CPP)) {
							// 如果源文件中存在 C++ 类型, 那么可执行文件也会切换成 C++ 方式来编译
							dynamicFilePtr->addFileFlags(CFileType::CFT_CPP);
						}
					}

					if(libPropPtr->isArray()) {
						if(depBundle.get() != nullptr) {
							auto depMap = depBundle->depMap;
							auto libArrPropPtr = (ArrayProp *) libPropPtr.get();
							for(auto depIter = libArrPropPtr->begin() ; depIter != libArrPropPtr->end() ; depIter ++) {
								auto depName = (*depIter)->getValue();
								auto existDep = depMap->find(depName);
								if(existDep == depMap->end()) {
									// 如果已经加载完毕依赖, 但是没有找到对应依赖库
									this->throwException("do not found dep %s, in library: %s", depName.c_str(), libName.c_str());
								}
								auto depStaticFilePtr = existDep->second->staticFilePtr;
								if(depStaticFilePtr.get() != nullptr) {
									if(!depStaticFilePtr->isExist()) {
										this->throwException("dep %s static file broken, in library: %s", depName.c_str(), libName.c_str());
									}
									std::shared_ptr<FileWrapper> libraryFilePtr(new FileWrapper(new VLFile(*depStaticFilePtr)));
									libraryFilePtr->setFileFlags(CFileType::CFT_STATIC);
									libraryFilePtr->setFileChanged(false);
									staticFilePtr->addDependentFile(libraryFilePtr);
								}
								auto depNopStaticFilePtr = existDep->second->nopStaticFilePtr;
								if(depNopStaticFilePtr.get() != nullptr) {
									if(!depNopStaticFilePtr->isExist()) {
										this->throwException("dep %s nop-static file broken, in library: %s", depName.c_str(), libName.c_str());
									}
									std::shared_ptr<FileWrapper> libraryFilePtr(new FileWrapper(new VLFile(*depNopStaticFilePtr)));
									libraryFilePtr->setFileFlags(CFileType::CFT_STATIC);
									libraryFilePtr->setFileChanged(false);
									dynamicFilePtr->addDependentFile(libraryFilePtr);
									nopStaticFilePtr->addDependentFile(libraryFilePtr);
								}

								if(!existDep->second->LDFLAGS.empty()) {
									ldflags += existDep->second->LDFLAGS;
								}
							}
						} else {
							// 标记为缺失依赖库
							libraryBundlePtr->dismissDep = true;
						}
					}

					libraryBundlePtr->dynamicFilePtr = dynamicFilePtr;
					libraryBundlePtr->nopStaticFilePtr = nopStaticFilePtr;
					libraryBundlePtr->staticFilePtr = staticFilePtr;
				}

				libraryBundlePtr->name = libName;
				libraryBundlePtr->LDFLAGS = ldflags;

				if(configBundle->libBundlesPtr.get() == nullptr) {
					configBundle->libBundlesPtr.reset(new std::vector<std::shared_ptr<CLibraryBundle>>);
				}
				configBundle->libBundlesPtr->push_back(libraryBundlePtr);
			} 
		}

		configBundle->aspect |= ConfigureParams::ConfigOptions::CO_CompileLibrary;
	}

	/**
	 * +======================================================================================================================+
	 * @Author: CimZzz
	 * @Date: 2022-10-24 17:12:24
	 * 
	 * 代码分割块，以下内容涉及: 
	 * 
	 * 特性列表解析
	 * 
	 */
	if(configureParams->configOptions == ConfigureParams::ConfigOptions::CO_ShowFeature && (configBundle->aspect & ConfigureParams::ConfigOptions::CO_ShowFeature) != ConfigureParams::ConfigOptions::CO_ShowFeature) {
		auto featureDescPropPtr = configPropPtr->get("FEATURE_DESC");
		if(featureDescPropPtr->isMap()) {
			// 解析特性列表
			auto featureDescMapPropPtr = (MapProp*) featureDescPropPtr.get();
			for(auto iter = featureDescMapPropPtr->begin() ; iter != featureDescMapPropPtr->end() ; iter ++) {
				auto featureItemPtr = iter->second;
				if(featureItemPtr->isNode()) {
					if(configBundle->featureDescsPtr.get() == nullptr) {
						configBundle->featureDescsPtr.reset(new std::unordered_map<std::string, std::string>());
					}
					configBundle->featureDescsPtr->emplace(iter->first, featureItemPtr->getValue());
				}
			}
		}
		configBundle->aspect |= ConfigureParams::ConfigOptions::CO_ShowFeature;
	}

	/**
	 * +======================================================================================================================+
	 * @Author: CimZzz
	 * @Date: 2022-10-25 19:15:33
	 * 
	 * 代码分割块，以下内容涉及: 
	 * 
	 * 项目版本号解析
	 * 
	 */
	if(configureParams->configOptions == ConfigureParams::ConfigOptions::CO_PrintVersion) {
		auto versionPropPtr = configPropPtr->get("VERSION");
		if(versionPropPtr->isNode()) {
			printf("%s", versionPropPtr->getValue().c_str());
		}
		return;
	}

	// 至此, 解析配置文件完毕
	// 判断是否需要进行打印
	if(configureParams->needPrint) {
		this->printConfig(*configBundle);
	}
}

/**
 * @Author: CimZzz
 * @Date: 2022-08-19 17:35:25
 * 
 * 打印配置信息
 * 
 * @param configBundle 配置参数集合
 */
void CConfigSupport::printConfig(const CConfigBundle& bundle) {
	// 打印配置相关信息
	printf("=============== Configure Info ===============\n");
	if((bundle.aspect & ConfigureParams::ConfigOptions::CO_CompileOption) != 0) {
		// 存在编译参数
		printf("Compile Options: \n");
		printf("%-18s: %s\n", "CC", bundle.CC.c_str());
		printf("%-18s: %s\n", "CXX", bundle.CXX.c_str());
		printf("%-18s: %s\n", "AR", bundle.AR.c_str());
		printf("%-18s: %s\n", "RANLIB", bundle.RANLIB.c_str());
		printf("%-18s: %s\n", "SYSROOT", bundle.SYSROOT.c_str());
		printf("%-18s: %s\n", "CFLAGS", bundle.CFLAGS.c_str());
		printf("%-18s: %s\n", "CXXFLAGS", bundle.CXXFLAGS.c_str());
		printf("%-18s: %s\n", "CPPFLAGS", bundle.CPPFLAGS.c_str());
		printf("%-18s: %s\n", "CPPFLAGS", bundle.CPPFLAGS.c_str());
		printf("\n");
	}
	if((bundle.aspect & ConfigureParams::ConfigOptions::CO_ReadDependencies) != 0) {
		if(bundle.remoteDependenciesPtr.get() != nullptr) {
			// 存在远程依赖库
			printf("Remote Dependencies: \n");
			for(auto iter = bundle.remoteDependenciesPtr->begin() ; iter != bundle.remoteDependenciesPtr->end() ; iter ++) {
				auto dependency = (*iter);
				printf("-----\n");
				printf("%-18s: %s\n", "NAME", dependency->name.c_str());
				printf("%-18s: %s\n", "METHOD", dependency->method.c_str());
				printf("%-18s: %s\n", "BRANCH", dependency->extraInfo.c_str());
				printf("%-18s: %s\n", "PATH", dependency->path.c_str());
			}
			printf("\n");
		}
	}
	if((bundle.aspect & ConfigureParams::ConfigOptions::CO_CompileTest) == ConfigureParams::ConfigOptions::CO_CompileTest) {
		if(bundle.testBundlesPtr.get() != nullptr) {
			// 存在远程依赖库
			printf("Test Units: \n");
			for(auto iter = bundle.testBundlesPtr->begin() ; iter != bundle.testBundlesPtr->end() ; iter ++) {
				auto test = (*iter);
				printf("-----\n");
				if(test->dismissDep) {
					printf("\033[31m[miss dependency, need call \"vl_build dep\" to load dependencies ...\033[0m\n");
				}
				printf("%-18s: %s\n", "NAME", test->name.c_str());
				printf("%-18s: %s\n", "DESC", test->desc.c_str());
				printf("%-18s: %s\n", "CPPFLAGS", test->CPPFLAGS.c_str());
				printf("%-18s: %s\n", "COMPILE_FLAGS", test->COMPILE_FLAGS.c_str());
				printf("%-18s: %s\n", "LDFLAGS", test->LDFLAGS.c_str());
				printf("%-18s: %s\n", "PRODUCT", test->testFilePtr->getAbsolutePathStr());
				printf("%-18s: \n", "TARGETS");
				auto depFileListPtr = test->testFilePtr->getDependentFileList();
				for(auto targetIter = depFileListPtr->begin() ; targetIter != depFileListPtr->end() ; targetIter ++) {
					printf("- %s\n", (*targetIter)->getAbsolutePathStr());
				}
			}
			printf("\n");
		}
		if(bundle.checkTestBundlesPtr.get() != nullptr) {
			// 存在远程依赖库
			printf("Check Test Units: \n");
			for(auto iter = bundle.checkTestBundlesPtr->begin() ; iter != bundle.checkTestBundlesPtr->end() ; iter ++) {
				auto test = (*iter);
				printf("-----\n");
				printf("%-18s: %s\n", test->name.c_str(), test->desc.c_str());
				if(test->passParamsList.get() != nullptr) {
					printf("%-18s: \n", "RUN PARAMS");
					for(auto paramsIter = test->passParamsList->begin() ; paramsIter != test->passParamsList->end() ; paramsIter ++) {
						printf("- %s\n", paramsIter->c_str());
					}
				}
				
			}
			printf("\n");
		}
	}
	if((bundle.aspect & ConfigureParams::ConfigOptions::CO_CompileExecutable) == ConfigureParams::ConfigOptions::CO_CompileExecutable) {
		if(bundle.execBundlesPtr.get() != nullptr) {
			// 存在远程依赖库
			printf("Executables: \n");
			for(auto iter = bundle.execBundlesPtr->begin() ; iter != bundle.execBundlesPtr->end() ; iter ++) {
				auto exec = (*iter);
				printf("-----\n");
				if(exec->dismissDep) {
					printf("\033[31m[miss dependency, need call \"vl_build dep\" to load dependencies ...\033[0m\n");
				}
				printf("%-18s: %s\n", "NAME", exec->name.c_str());
				printf("%-18s: %s\n", "LDFLAGS", exec->LDFLAGS.c_str());
				printf("%-18s: %s\n", "PRODUCT", exec->executableFilePtr->getAbsolutePathStr());
				printf("%-18s: \n", "TARGETS");
				auto depFileListPtr = exec->executableFilePtr->getDependentFileList();
				for(auto targetIter = depFileListPtr->begin() ; targetIter != depFileListPtr->end() ; targetIter ++) {
					printf("%s\n", (*targetIter)->getAbsolutePathStr());
				}
			}
			printf("\n");
		}
	}
	if((bundle.aspect & ConfigureParams::ConfigOptions::CO_CompileLibrary) == ConfigureParams::ConfigOptions::CO_CompileLibrary) {
		if(bundle.libBundlesPtr.get() != nullptr) {
			// 存在远程依赖库
			printf("Libraries: \n");
			for(auto iter = bundle.libBundlesPtr->begin() ; iter != bundle.libBundlesPtr->end() ; iter ++) {
				auto lib = (*iter);
				printf("-----\n");
				if(lib->dismissDep) {
					printf("\033[31m[miss dependency, need call \"vl_build dep\" to load dependencies ...\033[0m\n");
				}
				printf("%-18s: %s\n", "NAME", lib->name.c_str());
				printf("%-18s: %s\n", "LDFLAGS", lib->LDFLAGS.c_str());
				printf("%-18s: \n", "HEADERS");
				auto depFileListPtr = &lib->headerFileListPtr;
				for(auto targetIter = depFileListPtr->begin() ; targetIter != depFileListPtr->end() ; targetIter ++) {
					printf("- %s\n", (*targetIter)->getAbsolutePathStr());
				}
				if(lib->dynamicFilePtr.get() != nullptr) {
					printf("%-18s: \n", "DYNAMIC TARGETS & NOP STATIC TARGETS");
					depFileListPtr = lib->dynamicFilePtr->getDependentFileList().get();
					for(auto targetIter = depFileListPtr->begin() ; targetIter != depFileListPtr->end() ; targetIter ++) {
						printf("- %s\n", (*targetIter)->getAbsolutePathStr());
					}

					printf("%-18s: \n", "STATIC TARGETS");
					depFileListPtr = lib->staticFilePtr->getDependentFileList().get();
					for(auto targetIter = depFileListPtr->begin() ; targetIter != depFileListPtr->end() ; targetIter ++) {
						printf("- %s\n", (*targetIter)->getAbsolutePathStr());
					}
				}
			}
			printf("\n");
		}
	}
	if((bundle.aspect & ConfigureParams::ConfigOptions::CO_ShowFeature) == ConfigureParams::ConfigOptions::CO_ShowFeature) {
		if(bundle.featureDescsPtr.get() != nullptr) {
			// 存在特性列表描述
			printf("Features: \n");
			for(auto iter = bundle.featureDescsPtr->begin() ; iter != bundle.featureDescsPtr->end() ; iter ++) {
				auto feature = (*iter);
				printf("%-18s: %s\n", feature.first.c_str(), feature.second.c_str());
			}
			printf("\n");
		}
	}
}


/**
 * @Author: CimZzz
 * @Date: 2022-08-19 19:01:24
 * 
 * 为源文件池生成源文件指针
 * 
 * @param srcDir 源文件目录
 * @param validDir 源文件校验文件目录
 * @param fileKey 文件键值
 * 
 * @return 源文件指针
 */
std::shared_ptr<FileWrapper> CConfigSupport::makeSourceFilePtr(const VLFile& srcDir, const VLFile& validDir, const std::string& fileKey, bool isTestFile) {
	std::shared_ptr<FileWrapper> sourceFilePtr(new FileWrapper(new VLRealPathFile(srcDir, fileKey)));

	// 根据源文件扩展名区分源文件类型
	auto extName = sourceFilePtr->getFilePtr()->getExtName();
	if(extName == ".c") {
		sourceFilePtr->addFileFlags(CFileType::CFT_C);
	} else if(extName == ".cpp") {
		sourceFilePtr->addFileFlags(CFileType::CFT_CPP);
	} else {
		this->throwException("unknown source file type: %s", sourceFilePtr->getAbsolutePathStr());
	}

	// 给源文件配置校验文件
	if(isTestFile) {
		sourceFilePtr->setupValidFile(new ValidFile(new VLFile(validDir, fileKey + ".c_ts_ts")));
	} else {
		sourceFilePtr->setupValidFile(new ValidFile(new VLFile(validDir, fileKey + ".c_s_ts")));
	}

	return sourceFilePtr;
}

/**
 * @Author: CimZzz
 * @Date: 2022-08-19 19:24:33
 * 
 * 为目标文件池生成目标文件指针
 * 
 * @param isForDynamic 是否作为动态链接库的目标文件
 * @param srcDir 目标文件目录
 * @param validDir 目标文件校验文件目录
 * @param fileKey 文件键值
 * @param sourceFilePtr 源文件指针
 * @param isTestTarget 是否为测试目标文件
 * 
 * @return 目标文件指针
 */
std::shared_ptr<FileWrapper> CConfigSupport::makeTargetFilePtr(
	bool isForDynamic,
	const VLFile& targetDir, 
	const VLFile& validDir, 
	const std::string& fileKey,
	const std::shared_ptr<FileWrapper>& sourceFilePtr,
	bool isTestTarget
) {
	std::shared_ptr<FileWrapper> targetFilePtr(new FileWrapper(new VLFile(targetDir, fileKey, ".o")));

	// 复制源文件类型到目标文件上, 并添加目标文件标志
	targetFilePtr->setFileFlags(sourceFilePtr->getFileFlag());
	targetFilePtr->addFileFlags(CFileType::CFT_O);

	// 添加源文件为目标文件的依赖文件
	targetFilePtr->addDependentFile(sourceFilePtr);

	// 给目标文件配置校验文件
	if(isTestTarget) {
		targetFilePtr->setupValidFile(new ValidFile(new VLFile(validDir, fileKey + ".c_tt_ts")));
	} else if(isForDynamic) {
		targetFilePtr->addFileFlags(CFileType::CFT_DYM);
		targetFilePtr->setupValidFile(new ValidFile(new VLFile(validDir, fileKey + ".c_t_l_ts")));
	} else {
		targetFilePtr->setupValidFile(new ValidFile(new VLFile(validDir, fileKey + ".c_t_p_ts")));
	}

	return targetFilePtr;
}
	
/**
 * @Author: CimZzz
 * @Date: 2022-08-19 19:42:10
 * 
 * 生成可执行文件指针
 * 
 * @param installDir 可执行文件安装目录
 * @param validDir 可执行文件校验文件目录
 * @param fileName 可执行文件名
 * @param isTestFile 判断是否为测试用例中的可执行文件
 * 
 * @return 可执行文件指针
 */
std::shared_ptr<FileWrapper> CConfigSupport::makeExecutableFilePtr(
	const VLFile& installDir,
	const VLFile& validDir,
	const std::string& fileName,
	bool isTestFile
) {
	std::shared_ptr<FileWrapper> execFilePtr(new FileWrapper(new VLFile(installDir, fileName)));
	
	// 给可执行文件配置校验文件
	if(isTestFile) {
		execFilePtr->setupValidFile(new ValidFile(new VLFile(validDir, "test_" + fileName + "_ts")));
	} else {
		execFilePtr->setupValidFile(new ValidFile(new VLFile(validDir, "exec_" + fileName + "_ts")));
	}

	execFilePtr->setFileFlags(CFileType::CFT_EXEC);

	return execFilePtr;
}

/**
 * @Author: CimZzz
 * @Date: 2022-08-20 16:43:21
 * 
 * 生成头文件指针
 * 
 * @param installDir 头文件安装目录
 * @param fileName 头文件名
 * 
 * @return 头文件指针
 */
std::shared_ptr<FileWrapper> CConfigSupport::makeHeaderFilePtr (
	const VLFile& installDir,
	const std::string& fileName
) {
	std::shared_ptr<FileWrapper> headerFilePtr(new FileWrapper(new VLFile(installDir, fileName)));

	if(headerFilePtr->getFilePtr()->getExtName() != ".h") {
		this->throwException("unknown header file type: %s", headerFilePtr->getAbsolutePathStr());
	}

	headerFilePtr->setFileFlags(CFileType::CFT_H);

	return headerFilePtr;
}

/**
 * @Author: CimZzz
 * @Date: 2022-08-19 19:42:10
 * 
 * 生成库文件指针
 * 
 * @param libFlags 库标志 0 - 动态库, 1 - 静态库, 2 - 位置无关静态库
 * @param installDir 库文件安装目录
 * @param validDir 库文件校验文件目录
 * @param fileName 库文件名
 * 
 * @return 库文件指针
 */
std::shared_ptr<FileWrapper> CConfigSupport::makeLibraryFilePtr(
	uint8_t libFlags,
	const VLFile& installDir,
	const VLFile& validDir,
	const std::string& fileName
) {
	if(libFlags == 0) {
		std::shared_ptr<FileWrapper> libraryFilePtr(new FileWrapper(new VLFile(installDir, "lib" + fileName + VL_C_COMPILE_DYM_POSTFIX_KEY)));

		libraryFilePtr->setFileFlags(CFileType::CFT_DYM);

		// 给库文件配置校验文件
		libraryFilePtr->setupValidFile(new ValidFile(new VLFile(validDir, "lib_dym_" + fileName + "_ts")));

		return libraryFilePtr;
	} if(libFlags == 1) {
		std::shared_ptr<FileWrapper> libraryFilePtr(new FileWrapper(new VLFile(installDir, "lib" + fileName + VL_C_COMPILE_STATIC_POSTFIX_KEY)));

		libraryFilePtr->setFileFlags(CFileType::CFT_STATIC);

		// 给库文件配置校验文件
		libraryFilePtr->setupValidFile(new ValidFile(new VLFile(validDir, "lib_static_" + fileName + "_ts")));

		return libraryFilePtr;
	} else {
		std::shared_ptr<FileWrapper> libraryFilePtr(new FileWrapper(new VLFile(installDir, "lib" + fileName + VL_C_COMPILE_NOP_STATIC_POSTFIX_KEY)));

		libraryFilePtr->setFileFlags(CFileType::CFT_STATIC);

		// 给库文件配置校验文件
		libraryFilePtr->setupValidFile(new ValidFile(new VLFile(validDir, "lib_nop_static_" + fileName + "_ts")));

		return libraryFilePtr;
	}
	
	

}